package com.ihr360.oneclick.controller;

import com.ihr360.commons.entity.AuthUserInfo;
import com.ihr360.commons.lang.DateUtils;
import com.ihr360.commons.vo.ResultInfo;
import com.ihr360.oneclick.entity.RowHeaderColumn;
import com.ihr360.oneclick.entity.Spreadsheet;
import com.ihr360.oneclick.entity.StaffRecord;
import com.ihr360.oneclick.modal.ExcelImportContext;
import com.ihr360.oneclick.request.SearchRequest;
import com.ihr360.oneclick.request.SpreadsheetDeleteRequest;
import com.ihr360.oneclick.request.SpreadsheetDetailRequest;
import com.ihr360.oneclick.request.SpreadsheetFootColumnRequest;
import com.ihr360.oneclick.request.SpreadsheetImportRequest;
import com.ihr360.oneclick.request.SpreadsheetPublishRequest;
import com.ihr360.oneclick.request.SpreadsheetRowDeleteRequest;
import com.ihr360.oneclick.request.query.SpreadsheetQueryParam;
import com.ihr360.oneclick.service.ExcelHandlerService;
import com.ihr360.oneclick.service.RowHeaderColumnService;
import com.ihr360.oneclick.service.SpreadsheetRowService;
import com.ihr360.oneclick.service.SpreadsheetService;
import com.ihr360.oneclick.vo.ExcelImportResult;
import com.ihr360.oneclick.vo.FootColumnVo;
import com.ihr360.oneclick.vo.OneClickResultVo;
import com.ihr360.oneclick.vo.PageData;
import com.ihr360.oneclick.vo.SpreadsheetDetailVo;
import com.ihr360.oneclick.vo.SpreadsheetRowDetailVo;
import com.ihr360.rest.service.IrenshiDubboProviderService;
import com.ihr360.rest.service.IrenshiWeixinService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 电子表格处理相关接口
 *
 * @author tom
 * @date 17-12-27
 */
@RestController
@RequestMapping("/spreadsheet")
@Api(value = "/spreadsheet", description = "电子表格处理接口相关信息", produces = ("application/json;charset=UTF-8"))
public class SpreadsheetController {

    @Autowired
    private SpreadsheetService spreadsheetService;
    @Autowired
    private SpreadsheetRowService spreadsheetRowService;
    @Autowired
    private ExcelHandlerService excelHandlerService;
    @Autowired
    private IrenshiDubboProviderService irenshiDubboProviderService;
    @Autowired
    private RowHeaderColumnService rowHeaderColumnService;

    @Autowired
    private IrenshiWeixinService irenshiWeixinService;

    @PostMapping(value = "/pageData")
    @ApiOperation(value = "/pageData", httpMethod = "POST", notes = "获取电子表格分页数据",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<PageData<Spreadsheet>> getPageData(@RequestBody SearchRequest<SpreadsheetQueryParam> searchRequest, AuthUserInfo authUserInfo) {
        PageData<Spreadsheet> pageData = spreadsheetService.getPageDataByCompanyId(authUserInfo.getCompanyId(), authUserInfo.getUserId(), searchRequest);
        return new ResultInfo.Builder<PageData<Spreadsheet>>().success(pageData);
    }

    @PostMapping(value = "/detail")
    @ApiOperation(value = "/detail", httpMethod = "POST", notes = "获取电子表格详情数据, 编辑、查看电子表格可调用",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<SpreadsheetDetailVo> getDetail(@RequestBody SpreadsheetDetailRequest spreadsheetDetailRequest,
                                                     AuthUserInfo authUserInfo) {
        spreadsheetDetailRequest.setCompanyId(authUserInfo.getCompanyId());
        SpreadsheetDetailVo spreadsheetDetail = spreadsheetService.getSpreadsheetDetail(spreadsheetDetailRequest);
        return new ResultInfo.Builder<SpreadsheetDetailVo>().success(spreadsheetDetail);
    }

    /*@PostMapping(value = "/temp/detail")
    @ApiOperation(value = "/temp/detail", httpMethod = "POST", notes = "获取电子表格草稿详情数据, 编辑电子表格可调用",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<SpreadsheetDetailVo> getTempDetail(@RequestBody SpreadsheetDetailRequest spreadsheetDetailRequest,
                                                         AuthUserInfo authUserInfo) {
        spreadsheetDetailRequest.setCompanyId(authUserInfo.getCompanyId());
        spreadsheetDetailRequest.setQueryTempRow(true);
        SpreadsheetDetailVo spreadsheetDetail = spreadsheetService.getSpreadsheetDetail(spreadsheetDetailRequest);
        return new ResultInfo.Builder<SpreadsheetDetailVo>().success(spreadsheetDetail);
    }*/

    @GetMapping(value = "/prePublish/{spreadsheetId}")
    @ApiOperation(value = "/prePublish/{spreadsheetId}", httpMethod = "GET", notes = "预发布，不允许发布的行不会发布，需要通过导入改变允许发布状态才可发布",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo prePublish(@PathVariable String spreadsheetId, AuthUserInfo authUserInfo) {
        spreadsheetService.prePublishSpreadsheet(authUserInfo.getCompanyId(), spreadsheetId);
        return new ResultInfo.Builder<SpreadsheetDetailVo>().success();
    }

    @PostMapping(value = "/publish")
    @ApiOperation(value = "/publish", httpMethod = "POST", notes = "发布，不允许发布的行不会发布，需要通过导入改变允许发布状态才可发布",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo publish(@RequestBody SpreadsheetPublishRequest spreadsheetPublishRequest, AuthUserInfo authUserInfo) {
        /*String password = spreadsheetPublishRequest.getPassword();
        if(!authUserInfo.getMobileNo().equals(ConstantString.USER_MOBILE_WHITE_LIST)) {
            if(StringUtils.isBlank(password)) {
                throw new OneClickException("one_click_term_passoword_is_null", "密码不能为空！");
            }else if(!irenshiDubboProviderService.checkCompanyPassword(authUserInfo, password)) {
                throw new OneClickException("one_click_term_password_error", "密码错误！");
            }
        }*/
        spreadsheetService.publishSpreadsheet(authUserInfo.getCompanyId(), authUserInfo.getUserId(), spreadsheetPublishRequest);
        return new ResultInfo.Builder<SpreadsheetDetailVo>().success();
    }

    @PostMapping(value = "/rowPublish")
    @ApiOperation(value = "/rowPublish", httpMethod = "POST", notes = "发布通知",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public Boolean rowPublish(@RequestBody SpreadsheetPublishRequest spreadsheetPublishRequest,AuthUserInfo authUserInfo){
        spreadsheetService.publishSpreadSheetRow(authUserInfo.getCompanyId(),spreadsheetPublishRequest);
        return true;
    }

    @PostMapping(value = "/oneClickPublish")
    @ApiOperation(value = "/oneClickPublish", httpMethod = "POST", notes = "群发工资条",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo oneClickPublish(@RequestBody SpreadsheetPublishRequest spreadsheetPublishRequest,AuthUserInfo authUserInfo){
        spreadsheetService.oneclickPublishSpreadSheet(authUserInfo.getCompanyId(),spreadsheetPublishRequest);
        return new ResultInfo.Builder<>().success();
    }

    @PostMapping(value = "/oneClickResult")
    @ApiOperation(value = "/oneClickResult", httpMethod = "POST", notes = "群发工资条后查询结果",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public OneClickResultVo oneClickResult(@RequestParam String spreadsheetId){
        OneClickResultVo oneClickReslutVo = spreadsheetRowService.getNoticeResult(spreadsheetId);
        return oneClickReslutVo;
    }



    @DeleteMapping(value = "/deleteSpreadSheet")
    @ApiOperation(value = "/spreadsheet/deleteSpreadSheet", httpMethod = "DELETE", notes = "删除，物理删除",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo delete(@RequestBody SpreadsheetDeleteRequest deleteRequest) {
        //TODO 校验密码 deleteRequest.getPassword()
        spreadsheetService.deleteSpreadsheetBatch(deleteRequest.getIdList());
        return new ResultInfo.Builder<SpreadsheetDetailVo>().success();
    }

    @DeleteMapping(value = "row")
    @ApiOperation(value = "row", httpMethod = "DELETE", notes = "删除行，物理删除",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo deleteRow(@RequestBody SpreadsheetRowDeleteRequest spreadsheetRowDeleteRequest) {
        spreadsheetRowService.deleteByIdList(spreadsheetRowDeleteRequest.getSpreadsheetId(),
                spreadsheetRowDeleteRequest.getIdList());
        spreadsheetService.saveFootData(spreadsheetRowDeleteRequest.getSpreadsheetId());
        return new ResultInfo.Builder<>().success();
    }

    @DeleteMapping(value = "row/all")
    @ApiOperation(value = "row/all", httpMethod = "DELETE", notes = "删除所有行，物理删除",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo deleteRowAll(@RequestParam String spreadsheetId) {
        spreadsheetRowService.deleteAll(spreadsheetId);
        spreadsheetService.saveFootData(spreadsheetId);
        return new ResultInfo.Builder<>().success();
    }

    @PostMapping(value = "/upload")
    @ApiOperation(value = "/upload", httpMethod = "POST", notes = "Excel 导入数据",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ExcelImportContext upload(@RequestParam String monthStr,
                                     @RequestParam String termId,
                                     @RequestParam(defaultValue = "false") Boolean weChatNotice,
                                     @RequestParam(defaultValue = "false") Boolean smsNotice,
                                     @RequestParam(defaultValue = "false") Boolean emailNotice,
                                     @RequestParam(required = false) String salaryTypeId,
                                     MultipartFile file, AuthUserInfo authUserInfo) {
        SpreadsheetImportRequest spreadsheetDtoImportRequest = new SpreadsheetImportRequest();
        List<Map> excelData = rowHeaderColumnService.excelFieldFilter(file, termId);
        spreadsheetDtoImportRequest.setTermId(termId);
        spreadsheetDtoImportRequest.setExcelData(excelData);
        spreadsheetDtoImportRequest.setMonth(DateUtils.dateFormat(monthStr, DateUtils.STANDARD_DATE_FORMAT_YM1));
        spreadsheetDtoImportRequest.setCompanyId(authUserInfo.getCompanyId());
        spreadsheetDtoImportRequest.setWeChatNotice(weChatNotice);
        spreadsheetDtoImportRequest.setEmailNotice(emailNotice);
        spreadsheetDtoImportRequest.setSmsNotice(smsNotice);
        spreadsheetDtoImportRequest.setSalaryTypeId(salaryTypeId);
        spreadsheetDtoImportRequest.setCreatorId(authUserInfo.getUserId());
        ExcelImportContext excelImportContext = excelHandlerService.excelDataParse(spreadsheetDtoImportRequest);
        return excelImportContext;
    }

    @PostMapping(value = "/excel/data/save")
    @ApiOperation(value = "/excel/data/save", httpMethod = "POST", notes = "Excel 保存数据",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ExcelImportResult saveExcelData(@RequestBody ExcelImportContext excelImportContext) {
        ExcelImportResult excelImportResult = excelHandlerService.saveExcelData(excelImportContext);
        //RestToReturnUtils.setMessage("保存成功！");
        return excelImportResult;
    }

    @PostMapping(value = "/temp/detail")
    @ApiOperation(value = "/temp/detail", httpMethod = "POST", notes = "获取电子表格详情数据",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public SpreadsheetDetailVo getTempDetail(@RequestBody SpreadsheetDetailRequest spreadsheetDetailRequest) {
        SpreadsheetDetailVo spreadsheetDetail = spreadsheetService.getSpreadsheetTempDetail(spreadsheetDetailRequest);
        return spreadsheetDetail;
    }

    /*@PostMapping(value = "/detail")
    @ApiOperation(value = "/detail", httpMethod = "POST", notes = "获取电子表格详情数据",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public SpreadsheetDetailVo getDetail(@RequestBody SpreadsheetDetailRequest spreadsheetDetailRequest) {
        String spreadsheetId = spreadsheetDetailRequest.getSpreadsheetId();
        SpreadsheetDetailVo spreadsheetDetail = spreadsheetService.getSpreadsheetDetail(spreadsheetId);
        return spreadsheetDetail;
    }*/

    /*@PostMapping(value = "/upload")
    @ApiOperation(value = "/upload", httpMethod = "POST", notes = "Excel 导入",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<ExcelImportResult> upload(@RequestParam String termId,
                                                @RequestParam(required = false) String spreadsheetId,
                                                @RequestParam String sheetTitle,
                                                @RequestParam String monthStr,
                                                @RequestParam(defaultValue = "false") Boolean isSecondImport,
                                                @RequestParam String progressId,
                                                MultipartFile file, AuthUserInfo authUserInfo) {
        SpreadsheetImportRequest spreadsheetDtoImportRequest = new SpreadsheetImportRequest();
        List<RowHeaderColumn> rowHeaderColumnList = rowHeaderColumnService.getTermColumnMetaList(termId);
        List<String> columnList = rowHeaderColumnList.stream().map(RowHeaderColumn::getColumnDisplayName).collect(Collectors.toList());
        try {
            ExcelLogs logs = new ExcelLogs();
            ImportParams<Map> importParams = new ImportParams<>();
            importParams.setImportType(Map.class);
            ColumnSpecification ignoreColumnSpe =  ColumnSpecification.createCellSpecification(String.class, true);
            ignoreColumnSpe.setIgnoreColumn(true);
            String[] columns = new String[columnList.size()];
            for(int i = 0; i < columnList.size(); i++) {
                columns[i] = columnList.get(i);
            }
            ignoreColumnSpe.addColumns(columns);
            importParams.addColumnSpecification(ignoreColumnSpe);
            List<Map> excelData = (ArrayList<Map>) ExcelUtil.importExcel(importParams, file.getInputStream(), logs);
            spreadsheetDtoImportRequest.setExcelData(excelData);
        } catch (IOException e) {
            e.printStackTrace();
        }
        spreadsheetDtoImportRequest.setTermId(termId);
        spreadsheetDtoImportRequest.setSheetTitle(sheetTitle);
        spreadsheetDtoImportRequest.setMonth(DateUtils.dateFormat(monthStr, DateUtils.STANDARD_DATE_FORMAT_YM1));
        spreadsheetDtoImportRequest.setSpreadSheetId(spreadsheetId);
        spreadsheetDtoImportRequest.setCompanyId(authUserInfo.getCompanyId());
        spreadsheetDtoImportRequest.setCreatorId(authUserInfo.getUserId());
        spreadsheetDtoImportRequest.setIsSecondImport(isSecondImport);
        ExcelImportContext excelImportContext = excelHandlerService.excelDataParse(spreadsheetDtoImportRequest);
        excelImportContext.setUserId(authUserInfo.getUserId());
        ExcelImportResult excelImportResult = excelHandlerService.saveExcelTempData(excelImportContext);
        return new ResultInfo.Builder<ExcelImportResult>().success(excelImportResult);
    }*/

    @PostMapping(value = "/excel/data/parse")
    @ApiOperation(value = "/excel/data/parse", httpMethod = "POST", notes = "Excel data 业务解析",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<ExcelImportContext> excelDataParse(@RequestBody SpreadsheetImportRequest spreadsheetImportRequest) {
        ExcelImportContext excelImportContext = excelHandlerService.excelDataParse(spreadsheetImportRequest);
        return new ResultInfo.Builder<ExcelImportContext>().success(excelImportContext);
    }

   /* @PostMapping(value = "/excel/data/save")
    @ApiOperation(value = "/excel/data/save", httpMethod = "POST", notes = "Excel data 保存",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<Spreadsheet> saveExcelData(@RequestBody ExcelImportContext excelImportContext){
        Spreadsheet spreadsheet = excelHandlerService.saveExcelData(excelImportContext);
        return new ResultInfo.Builder<Spreadsheet>().success(spreadsheet);
    }*/

    @PostMapping(value = "/excel/data/staff/list")
    @ApiOperation(value = "/excel/data/staff/list", httpMethod = "POST", notes = "获取导入的员工名录列表",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<List<StaffRecord>> getExcelImportStaffList(@RequestBody Spreadsheet spreadsheet) {
        List<StaffRecord> staffRecordList = excelHandlerService.getExcelImportStaffList(spreadsheet);
        return new ResultInfo.Builder<List<StaffRecord>>().success(staffRecordList);
    }

    /*@PostMapping(value = "/excel/data/save")
    @ApiOperation(value = "/excel/data/save", httpMethod = "POST", notes = "保存导入数据",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<Spreadsheet> saveExcelData(@RequestBody SaveExcelDataRequest saveExcelDataRequest) {
        Spreadsheet spreadsheet = excelHandlerService.saveExcelData(saveExcelDataRequest.getUserId(), saveExcelDataRequest.getSpreadsheet(), saveExcelDataRequest.getStaffRecordList());
        return new ResultInfo.Builder<Spreadsheet>().success(spreadsheet);
    }*/

    @PostMapping(value = "/excel/data/cancel")
    @ApiOperation(value = "/excel/data/cancel", httpMethod = "POST", notes = "取消保存",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<Spreadsheet> cancelSaveExcelData(@RequestBody String spreadsheetId) {
        Spreadsheet spreadsheet = excelHandlerService.cancelSaveExcelData(spreadsheetId);
        return new ResultInfo.Builder<Spreadsheet>().success(spreadsheet);
    }


    @DeleteMapping(value = "/excel/data/temp/row")
    @ApiOperation(value = "/excel/data/temp/row", httpMethod = "POST", notes = "删除草稿row",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<Spreadsheet> deleteTempExcelRow(@RequestBody SpreadsheetRowDeleteRequest spreadsheetRowDeleteRequest) {
        Spreadsheet spreadsheet = excelHandlerService.deleteTempExcelRow(spreadsheetRowDeleteRequest.getSpreadsheetId(),
                spreadsheetRowDeleteRequest.getIdList());
        return new ResultInfo.Builder<Spreadsheet>().success(spreadsheet);
    }

    @DeleteMapping(value = "/excel/data/temp/row/all")
    @ApiOperation(value = "/excel/data/temp/row/all", httpMethod = "POST", notes = "删除导入的所有草稿",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<Spreadsheet> deleteTempExcelRowAll(@RequestBody String spreadsheetId) {
        Spreadsheet spreadsheet = excelHandlerService.deleteTempExcelRowAll(spreadsheetId);
        return new ResultInfo.Builder<Spreadsheet>().success(spreadsheet);
    }

    @PostMapping(value = "/getFootHeader")
    @ApiOperation(value = "/getFootHeader", httpMethod = "POST", notes = "获取用户设置合计列",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo<List<FootColumnVo>> getFootHeader(@RequestParam String spreadsheetId) {
        List<FootColumnVo> footColumnVoList = new ArrayList<>();
        List<RowHeaderColumn> columnList = spreadsheetService.getRowHeader(spreadsheetId);
        List<RowHeaderColumn> footHeader = spreadsheetService.getFootHeader(spreadsheetId);
        if (CollectionUtils.isEmpty(columnList)) {
            return new ResultInfo.Builder<List<FootColumnVo>>().success(footColumnVoList);
        }
        Map<String, RowHeaderColumn> footMap = new HashMap<>();
        if (CollectionUtils.isNotEmpty(footHeader)) {
            footMap = footHeader.stream().collect(Collectors.toMap(RowHeaderColumn::getColumnDisplayName, rowHeaderColumn -> rowHeaderColumn));
        }
        for (RowHeaderColumn column : columnList) {
            FootColumnVo footColumnVo = new FootColumnVo();
            footColumnVo.setColumnDisplayName(column.getColumnDisplayName());
            if (footMap.containsKey(column.getColumnDisplayName())) {
                footColumnVo.setChoose(true);
            } else {
                footColumnVo.setChoose(false);
            }
            footColumnVoList.add(footColumnVo);
        }
        return new ResultInfo.Builder<List<FootColumnVo>>().success(footColumnVoList);
    }


    @PostMapping(value = "/save/footColumn")
    @ApiOperation(value = "/save/footColumn", httpMethod = "POST", notes = "保存用户设置合计列",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo saveFootColumn(@RequestBody SpreadsheetFootColumnRequest request) {
        spreadsheetService.saveFootColumn(request);
        return new ResultInfo.Builder<>().success();
    }

    @PostMapping(value = "/withdrawRowPublish")
    @ApiOperation(value = "/withdrawRowPublish", httpMethod = "POST", notes = "撤回发布信息")
    public ResultInfo withdrawRowPublish(@RequestBody List<String> spreadSheetRowId,String spreadsheetId) {
        spreadsheetService.withdrawRowPublish(spreadSheetRowId,spreadsheetId);
        return new ResultInfo.Builder<>().success();
    }

    @PostMapping("/getSpreadsheetRowInfo")
    @ApiOperation(value = "/getSpreadsheetRowInfo", httpMethod = "POST", notes = "获取单个工资条详细数据",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public SpreadsheetRowDetailVo getSpreadsheetRowInfo(@RequestParam String spreadSheetRowId) {
        SpreadsheetRowDetailVo spreadsheetRowDetailVoList = spreadsheetRowService.getSpreadsheetRowInfo(spreadSheetRowId);
        return spreadsheetRowDetailVoList;
    }

    @PostMapping("/updateSpreadsheetRowInfo")
    @ApiOperation(value = "/updateSpreadsheetRowInfo", httpMethod = "POST", notes = "获取单个工资条详细数据",
            consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8")
    public ResultInfo updateSpreadsheetRowInfo(@RequestBody SpreadsheetRowDetailVo spreadsheetRowDetailVo,@RequestParam String spreadsheetRowId){
        spreadsheetRowService.updateSpreadsheetRowInfo(spreadsheetRowDetailVo,spreadsheetRowId);
        return new ResultInfo.Builder<>().success();
    }

    @GetMapping("/test")
    public ResultInfo test(){
        String shorUrl = irenshiWeixinService.getShorUrl("www.ihr360.com");
        String base64 =  spreadsheetRowService.test(shorUrl);
        return new ResultInfo.Builder<>().success();
    }
}
